float BOTS_Draw_Ammo(int y, int type);
float BOTS_Draw_Health(int y);
float BOTS_Draw_Armor(int y);
void BOTS_Draw_Current_Weapon();



///////////////////////////////////////////////////////
// BOTS_DrawClassData
//
// This function will display class data present in the CS_BOTS_CLIENT
// config string
float BOTS_DrawClassData( float y ) 
{
	float		size = 0;	// used for heads - I think

	// class level
	tempString = va("Level %i", level);
	width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
	CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
	y += BIGCHAR_HEIGHT + 2;
	
	
	switch(classtype)
	{

///////////////////////////////////////////////////////
// START CAPTAIN
//
	case BOTS_CAPTAIN:
		{
			if (cg.predictedPlayerState.stats[STAT_BOTS_GENERAL] > 0)
			{
				tempString = va("%i->Key", cg.predictedPlayerState.stats[STAT_BOTS_GENERAL]);
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}
			// make "Promo Key" message blink
			else if ((cg.time / 1000) % 2 != 0)
			{
				tempString = va("Promo Key");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}

			if (level == 4)
			{
				int splitmode  = atoi(Info_ValueForKey(info, "sp"));
				int splitnum  = atoi(Info_ValueForKey(info, "sn"));

				if (!splitmode)
				{
					tempString = va("Split OFF");
					width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
					CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
					y += BIGCHAR_HEIGHT + 2;
				}
				else
				{
					tempString = va("Split %i", splitnum);
					width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
					CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
					y += BIGCHAR_HEIGHT + 2;
				}
			}
		}
		break;
//
// END CAPTAIN
///////////////////////////////////////////////////////

///////////////////////////////////////////////////////
// START BODYGUARD
//
	case BOTS_BODYGUARD:
		{
			int laserstate		= atoi(Info_ValueForKey(info, "las"));
			int lasertime		= atof(Info_ValueForKey(info, "lat"));
			int team_protect	= atoi(Info_ValueForKey(info, "prot"));
			int pulsemode		= atoi(Info_ValueForKey(info, "lp"));
			int lasernum		= atoi(Info_ValueForKey(info, "lan"));
			int decoytime		= atoi(Info_ValueForKey(info, "d"));

			if (lasernum)
			{
				if (level >= 3)
				{
					if (pulsemode)
					{
						tempString = va("Pulse ON");
						width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
						CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
						y += BIGCHAR_HEIGHT + 2;
					}
					else
					{
						tempString = va("Pulse OFF");
						width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
						CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
						y += BIGCHAR_HEIGHT + 2;
					}
				}// level 3 pulse
				
				if (laserstate)
				{
					tempString = va("Laser ON");
					width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
					CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
					y += BIGCHAR_HEIGHT + 2;

					// amount of time lasers have been on
					msec = cg.time - lasertime;
					seconds = msec / 1000;
					tempString = va( "%i seconds", seconds );
					width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
					CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
					y += BIGCHAR_HEIGHT + 2;
				}
				else
				{
					if (lasertime > cg.time)
					{
						tempString = va("Laser OFF");
						width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
						CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
						y += BIGCHAR_HEIGHT + 2;

						// time needed to cool lasers
						msec = lasertime - cg.time;
						seconds = msec / 1000;
						tempString = va( "%i seconds", seconds );
						width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
						CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
						y += BIGCHAR_HEIGHT + 2;
					}
					else
					{
						tempString = va("Laser Ready");
						width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
						CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
						y += BIGCHAR_HEIGHT + 2;
					}// lasertime - countdown
				}// laserstate
			}// lasernum > 0

			if (team_protect >= 0)
			{
				// draw the head, then the name
				const char* info;
				const char* name;
	
				info = CG_ConfigString( CS_PLAYERS + team_protect );
				name = Info_ValueForKey(  info, "n" );

				size = ICON_SIZE * 1.25;
				angles[PITCH] = 0;
				angles[YAW] = 180;
				angles[ROLL] = 0;
				CG_DrawHead( 640 - size, y, size, size, team_protect, angles );
				y += size;

				tempString = va("Protecting");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;

				tempString = va("%s", name);
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}

			if (decoytime > cg.time)
			{
				// amount of time lasers have been on
				msec = decoytime - cg.time;
				seconds = msec / 1000;
				tempString = va( "%i->decoy", seconds );
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}
		}// bodyguard
		break;
//
// END BODYGUARD
///////////////////////////////////////////////////////

///////////////////////////////////////////////////////
// START SNIPER
//
	case BOTS_SNIPER:
		{
			int cloakState  = atoi(Info_ValueForKey(info, "cs"));

			if (cloakState)
				tempString = va("Cloaked");
			else
			{
				switch (cg.predictedPlayerState.stats[STAT_BOTS_GENERAL]) {
				case -1:
					tempString = va("Moving");
					break;
				case 0:
					tempString = va("Cloaking");
					break;
				default:
					tempString = va("%i->Visible", cg.predictedPlayerState.stats[STAT_BOTS_GENERAL]);
				}
			}
			
			width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
			CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
			y += BIGCHAR_HEIGHT + 2;
		}
		break;
//
// END SNIPER
///////////////////////////////////////////////////////

///////////////////////////////////////////////////////
// START SOLDIER
//
	case BOTS_SOLDIER:
		{
			if (level > 0)
			{
				int conquer  = atoi(Info_ValueForKey(info, "cq"));

				if (conquer)
					tempString = va("Conquer ON");
				else
					tempString = va("Conquer OFF");

				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;

				if (level >= 2)
				{
					int splitmode  = atoi(Info_ValueForKey(info, "sp"));
					int splitnum  = atoi(Info_ValueForKey(info, "sn"));

					if (!splitmode)
					{
						// tag cannon
						if (level >= 2)
						{
							int tag = atoi(Info_ValueForKey(info, "tag"));
							if (tag)
							{
								tempString = va("Tag Cannon");
								width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
								CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
								y += BIGCHAR_HEIGHT + 2;
							}	
							else if (level >= 3) {
								// split rockets status
								tempString = va("Split OFF");
								width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
								CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
								y += BIGCHAR_HEIGHT + 2;
							}
						}

						// guided rockets
						if (level == 4)
						{
							int guide = atoi(Info_ValueForKey(info, "g"));
							if (guide)
							{
								tempString = va("Guided Rockets");
								width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
								CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
								y += BIGCHAR_HEIGHT + 2;
							}
						}// level 4
					}
					else
					{
						tempString = va("Split %i", splitnum);
						width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
						CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
						y += BIGCHAR_HEIGHT + 2;
					}// splitmode
				}// level >= 2
			}// level > 0
		}// soldier
		break;
//
// END SOLDIER
///////////////////////////////////////////////////////

///////////////////////////////////////////////////////
// START BERZERKER
//
	case BOTS_BERZERKER:
		{
			int ragestop	= atoi(Info_ValueForKey(info, "rt"));
			int quadstart	= atoi(Info_ValueForKey(info, "qt"));
			int nextcharge	= atoi(Info_ValueForKey(info, "ct"));

			if (quadstart > cg.time)
			{
				msec = quadstart - cg.time;
				seconds = msec / 1000;
				tempString = va( "%i-> Quad", seconds );
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}

			if (ragestop > cg.time)
			{
				msec = ragestop - cg.time;
				seconds = msec / 1000;
				tempString = va( "%i-> Rage", seconds );
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}

			if (nextcharge > cg.time)
			{
				msec = nextcharge - cg.time;
				seconds = msec / 1000;
				tempString = va( "%i-> Charge", seconds );
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}
			else
			{
				tempString = va("Charge Ready");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}
		}// berzerker
		break;
//
// END BERZERKER
///////////////////////////////////////////////////////

///////////////////////////////////////////////////////
// START INFILTRATOR
//
	case BOTS_INFILTRATOR:
		{
			int disguiseTime	= atoi(Info_ValueForKey(info, "dt"));
			int stealMode		= atoi(Info_ValueForKey(info, "sm"));

			if (stealMode)
			{
				tempString = va( "Steal ON");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}
			else
			{
				tempString = va( "Steal OFF");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}

			if (disguiseTime == INT_MAX)
			{
				msec = disguiseTime - cg.time;
				seconds = msec / 1000;
				tempString = va( "Disguise");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}
			else if (level >= 2)
			{
				if (disguiseTime > cg.time)
				{
					msec = disguiseTime - cg.time;
					seconds = msec / 1000;
					tempString = va( "%i-> Disguise", seconds );
					width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
					CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
					y += BIGCHAR_HEIGHT + 2;
				}
				else
				{
					tempString = va( "Disguise OFF");
					width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
					CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
					y += BIGCHAR_HEIGHT + 2;
				}
			}

			// Infiltrator head
			size = ICON_SIZE * 1.25;
			angles[PITCH] = 0;
			angles[YAW] = 180;
			angles[ROLL] = 0;
			CG_DrawHead( 640 - size, y, size, size, clientNum, angles );
			y += size;

			// normally I would combine this with the previous timer, but I want the class name
			// below the head
			if (disguiseTime > cg.time)
			{
				char className[30];

				switch (atoi(Info_ValueForKey(info, "dc")))
				{
				case BOTS_CAPTAIN:
					strcpy(className, "Captain");
					break;
				case BOTS_BODYGUARD:     
					strcpy(className, "Bodyguard");
					break;
				case BOTS_SNIPER:        
					strcpy(className, "Sniper");
					break;
				case BOTS_SOLDIER:       
					strcpy(className, "Soldier");
					break;
				case BOTS_BERZERKER:
					strcpy(className, "Berzerker");
					break;
				case BOTS_INFILTRATOR:
					strcpy(className, "Infiltrator");
					break;
				case BOTS_KAMIKAZEE:     
					strcpy(className, "Kamikazee");
					break;
				case BOTS_NURSE:         
					strcpy(className, "Nurse");
					break;
				case BOTS_SCIENTIST:     
					strcpy(className, "Scientist");
					break;
				}

				width = CG_DrawStrlen( className ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, className, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}// disguiseTime > cg.time
		}// infiltrator
		break;
//
// END INFILTRATOR
///////////////////////////////////////////////////////

///////////////////////////////////////////////////////
// START KAMIKAZEE
//
	case BOTS_KAMIKAZEE:
		{
			// int dettrap1 = 0;
			// int dettrap2 = 0;
			int detmode			= atoi(Info_ValueForKey(info, "dm"));
			int clustermode		= atoi(Info_ValueForKey(info, "cl"));
			int autorewiremode	= atoi(Info_ValueForKey(info, "rw"));
			int longrangemode	= atoi(Info_ValueForKey(info, "lr"));
			int stickmode		= atoi(Info_ValueForKey(info, "sm"));

			/*
			if (cg.predictedPlayerState.stats[STAT_BOTS_GENERAL] > 0)
			{
				dettrap2 = cg.predictedPlayerState.stats[STAT_BOTS_GENERAL] % 10;
				dettrap1 = floor(cg.predictedPlayerState.stats[STAT_BOTS_GENERAL]/10);
			}

			// dettrap1
			tempString = va( "%i->Det1", dettrap1);
			width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
			CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
			y += BIGCHAR_HEIGHT + 2;

			// dettrap2
			tempString = va( "%i->Det2", dettrap2);
			width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
			CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
			y += BIGCHAR_HEIGHT + 2;
			*/
			// grenade launcher mode
			if (detmode)
			{
				tempString = va( "Detmode");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}
			else if (clustermode)
			{
				tempString = va( "Cluster");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}
			else
			{
				tempString = va( "Normal");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}// grenade launcher mode

			// rewire
			if (autorewiremode)
			{
				tempString = va( "Rewire ON");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}
			else
			{
				tempString = va( "Rewire OFF");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}// rewire

			if (level > 1)
			{
				if (longrangemode)
				{
					tempString = va( "Long");
					width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
					CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
					y += BIGCHAR_HEIGHT + 2;
				}
				else
				{
					tempString = va( "Short");
					width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
					CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
					y += BIGCHAR_HEIGHT + 2;
				}				
			}// level > 1

			// sticky grenades
			if (stickmode)
			{
				tempString = va( "Stick");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}

		}// kamikazee
		break;
//
// END KAMIKAZEE
///////////////////////////////////////////////////////

///////////////////////////////////////////////////////
// START NURSE
//
	case BOTS_NURSE:
		{
			int poison	= atoi(Info_ValueForKey(info, "p"));

			if (poison)
				tempString = va( "Poison ON");
			else
				tempString = va( "Poison OFF");

			width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
			CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
			y += BIGCHAR_HEIGHT + 2;
		}
		break;
//
// END NURSE
///////////////////////////////////////////////////////

// START SCIENTIST
//
	case BOTS_SCIENTIST:
		{
			if (cg.predictedPlayerState.stats[STAT_BOTS_GENERAL] > 0)
			{
				tempString = va("%i->Key", cg.predictedPlayerState.stats[STAT_BOTS_GENERAL]);
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}
			// make "Tech Key" message blink
			else if ((cg.time / 1000) % 2 != 0)
			{
				tempString = va("Tech Key");
				width = CG_DrawStrlen( tempString ) * BIGCHAR_WIDTH;
				CG_DrawBigString( 635 - width, y + 2, tempString, 1.0F);
				y += BIGCHAR_HEIGHT + 2;
			}
		}
		break;
//
// END SCIENTIST
///////////////////////////////////////////////////////
	
	}// switch
	
	return y;
}















///////////////////////////////////////////////////////
// BOTS_Draw_Ammo
//
// Display the current ammo total and ammo model
//
float BOTS_Draw_Ammo(int y, int weapon)
{
	qhandle_t	icon;
	int			ammo_type = 1;

	y -= ICON_SIZE;

	// Because I want the icons with boxes around them, I need to do some tricks
	switch (weapon)
	{
	case WP_SHOTGUN:
		ammo_type = AMMO_SHELLS;
		break;
	case WP_MACHINEGUN:
		ammo_type = AMMO_BULLETS;
		break;
	case WP_ROCKET_LAUNCHER:
		ammo_type = AMMO_ROCKETS;
		break;
	case WP_RAILGUN:
		ammo_type = AMMO_SLUGS;
		break;
	case WP_GRENADE_LAUNCHER:
		ammo_type = AMMO_GRENADES;
		break;
	case WP_STINGER:
	case WP_PLASMAGUN:
	case WP_LIGHTNING:
	case WP_BFG:
		ammo_type	= AMMO_BFG;
		weapon		= WP_BFG;
		break;
	}

	// picture
	if (weapon < 0)
	{
		gitem_t	*item = BG_FindItemForPowerup(powerup);
		icon = cg_items[ITEM_INDEX(item)].icon;
		//CG_DrawPic( CHAR_WIDTH*3 + TEXT_ICON_SPACE, y, ICON_SIZE-5, ICON_SIZE-5, cg_items[ITEM_INDEX(item)].icon );
	}
	else
	{
		trap_R_SetColor( colors[0] );
		CG_DrawField (0, y, 3, cg.snap->ps.ammo[weapon]);	// numeric value
		trap_R_SetColor( NULL );

		icon = cg_items[ammo_type].icon;
	}

	if ( icon )
		CG_DrawPic( CHAR_WIDTH*3 + TEXT_ICON_SPACE, y, ICON_SIZE-5, ICON_SIZE-5, icon );

	if (ammo_type == AMMO_GRENADES)
	{
		vec4_t green = {0, .75, 0, .75};
		int numGrens1 = -1;
		int numGrens2 = -1;
		trap_R_SetColor( green );
		
		if (classtype == BOTS_CAPTAIN || classtype == BOTS_BODYGUARD)
			numGrens1 = atoi(Info_ValueForKey(  info, "np" ));
		else if (classtype == BOTS_INFILTRATOR)
			numGrens1 = atoi(Info_ValueForKey(  info, "nd" ));
		else if (classtype == BOTS_KAMIKAZEE)
		{
			numGrens1 = numGrens2 = 0;
			if (cg.predictedPlayerState.stats[STAT_BOTS_GENERAL] > 0)
			{
				numGrens2 = cg.predictedPlayerState.stats[STAT_BOTS_GENERAL] % 10;
				numGrens1 = floor(cg.predictedPlayerState.stats[STAT_BOTS_GENERAL]/10);
			}
		}

		if (numGrens1 >= 0)
			CG_DrawPic(100, y, 10, 16, cgs.media.numberShaders[numGrens1] );
		if (numGrens2 >= 0)
			CG_DrawPic(100, y+18, 10, 16, cgs.media.numberShaders[numGrens2] );

	}

	return y;
}

///////////////////////////////////////////////////////
// BOTS_Draw_Health
//
// Display the current health total and heal model
//
float BOTS_Draw_Health(int y)
{
	vec3_t	angles;
	vec3_t	origin;
	int		value;
	gitem_t *item; 


	y -= ICON_SIZE;

	value = cg.snap->ps.stats[STAT_HEALTH];
	if ( value > 75 ) {
		item = BG_FindItem("5 Health");
		trap_R_SetColor( colors[0] );		// white
	} else if (value > 25) {
		item = BG_FindItem("25 Health");
		trap_R_SetColor( colors[0] );	// green
	} else if (value > 0) {
		int			color;


		color = (cg.time >> 8) & 1;	// flash
		if (color)
			item = BG_FindItem("25 Health");
		else
			item = BG_FindItem("50 Health");

		trap_R_SetColor( colors[color] );
	} else {
		item = BG_FindItem("50 Health");
		trap_R_SetColor( colors[1] );	// red
	}

	// stretch the health up when taking damage
	CG_DrawField ( 0, y, 3, value);
	trap_R_SetColor( NULL );

	if (cg_draw3dIcons.integer) {
		// 3D icon
		origin[0] = 90;
		origin[1] = 0;
		origin[2] = -10;
		
		VectorClear( angles );
		angles[YAW] = ( cg.time & 2047 ) * 360 / 2048.0;
		CG_Draw3DModel( CHAR_WIDTH*3, y - 20, ICON_SIZE+15, ICON_SIZE+15,
			cgs.media.healthModelSphere, 0, origin, angles );
		CG_Draw3DModel( CHAR_WIDTH*3, y - 20, ICON_SIZE+15, ICON_SIZE+15,
			cgs.media.healthModelCross, 0, origin, angles );
	}
	else {
		if (item)
			CG_DrawPic( CHAR_WIDTH*3 + TEXT_ICON_SPACE, y, ICON_SIZE, ICON_SIZE, cg_items[ITEM_INDEX(item)].icon );
	}



	return y;
}

///////////////////////////////////////////////////////
// BOTS_Draw_Armor
//
// Display the current armor total and armor model
//
float BOTS_Draw_Armor(int y)
{
	vec3_t	angles;
	vec3_t	origin;
	int		value;

	y -= ICON_SIZE;

	value = cg.snap->ps.stats[STAT_ARMOR];
	trap_R_SetColor( colors[0] );
	CG_DrawField (0, y, 3, value);
	trap_R_SetColor( NULL );

	if (cg_draw3dIcons.integer) {
		// 3D icon
		origin[0] = 90;
		origin[1] = 0;
		origin[2] = -10;
		
		VectorClear( angles );
		angles[YAW] = ( cg.time & 2047 ) * 360 / 2048.0;
		CG_Draw3DModel( CHAR_WIDTH*3 + TEXT_ICON_SPACE, y, ICON_SIZE, ICON_SIZE,
			cgs.media.armorModel, 0, origin, angles );
	}
	else 
		//tbp: i want 2D icons if i say so! ;)
		CG_DrawPic( CHAR_WIDTH*3 + TEXT_ICON_SPACE, y, ICON_SIZE, ICON_SIZE, cgs.media.armorIcon );


	//CG_DrawField (CHAR_WIDTH*3 + TEXT_ICON_SPACE * 3, y, 3, cg.predictedPlayerState.stats[STAT_MAX_ARMOR]);


	return y;
}

///////////////////////////////////////////////////////
// BOTS_Draw_Current_Weapon
//
// Display the current weapon icon
//
void BOTS_Draw_Current_Weapon()
{
	int icon = 0;
	int ammo_type = 1;

	switch(cg.weaponSelect)
	{
	case WP_BFG:
		ammo_type = AMMO_BFG;
		break;
	case WP_SHOTGUN:
		ammo_type = AMMO_SHELLS;
		break;
	case WP_RAILGUN:
		ammo_type = AMMO_SLUGS;
		break;
	case WP_ROCKET_LAUNCHER:
		ammo_type = AMMO_ROCKETS;
		break;
	case WP_PLASMAGUN:
		ammo_type = AMMO_PLASMA;
		break;
	case WP_GRENADE_LAUNCHER:
		ammo_type = AMMO_GRENADES;
		break;
	case WP_MACHINEGUN:
		ammo_type = AMMO_BULLETS;
		break;
	case WP_LIGHTNING:
		ammo_type = AMMO_LIGHTNING;
		break;

	// KLUDGE TIME!!!
	case WP_GRAPPLING_HOOK:
		icon = cg_weapons[WP_GRAPPLING_HOOK].weaponIcon;
		break;
	case WP_GAUNTLET:
		icon = cg_weapons[WP_GAUNTLET].weaponIcon;
		break;
	case WP_STINGER:
		{
			if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_RED)
				icon = cgs.media.botsRedStinger;
			else
				icon = cgs.media.botsBlueStinger;
		}
		break;
	}
	
	// only Gauntlet and grapple could set icon to non zero
	if (icon == 0)
		icon = cg_items[ammo_type].icon;
	if ( icon )
		CG_DrawPic( 300, 380 + ICON_SIZE, ICON_SIZE-5, ICON_SIZE-5, icon );	
}




///////////////////////////////////////////////////////
// BOTS_DrawLowerLeft
//
// Calls to functions that display data in the lower left of the screen
//
void BOTS_DrawLowerLeft() 
{
	float		y;
	int			weapon = 1;


	switch (classtype) 
	{
		case BOTS_CAPTAIN:
			weapon = WP_BFG;
			break;
		case BOTS_BODYGUARD:
			weapon = WP_SHOTGUN;
			break;
		case BOTS_SNIPER:
			weapon = WP_RAILGUN;
			break;
		case BOTS_SOLDIER:
			weapon = WP_ROCKET_LAUNCHER;
			break;
		case BOTS_BERZERKER:
			weapon = WP_GAUNTLET;
			break;
		case BOTS_INFILTRATOR:
			weapon = WP_PLASMAGUN;
			break;
		case BOTS_KAMIKAZEE:
			weapon = WP_GRENADE_LAUNCHER;
			break;
		case BOTS_NURSE:
			weapon = WP_MACHINEGUN;
			break;
		case BOTS_SCIENTIST:
			weapon = WP_LIGHTNING;
			break;
	}

	y = 480;

	// start from the bottom of the screen and move up
	CG_DrawPickupItem( y - 10 );
	y = BOTS_Draw_Armor(y);
	y = BOTS_Draw_Health(y);
	y -= ICON_SIZE;

	// show cells only if cells are not the main weapon ammo
	if (classtype != BOTS_CAPTAIN		&& 
		classtype != BOTS_INFILTRATOR	&&
		classtype != BOTS_SCIENTIST)
		y = BOTS_Draw_Ammo(y, WP_BFG);

	// show grenades only if grenades are not the main weapon ammo
	if (classtype != BOTS_KAMIKAZEE)
		y = BOTS_Draw_Ammo(y, WP_GRENADE_LAUNCHER);

	// Main weapon type
	if (classtype != BOTS_BERZERKER)
		y = BOTS_Draw_Ammo(y, weapon);

	if (powerup != PW_NONE)
		y = BOTS_Draw_Ammo(y, -10);

	// current weapon
	BOTS_Draw_Current_Weapon();
}


///////////////////////////////////////////////////////
// BOTS_DrawStatusBar
//
// you got me...
//
void BOTS_DrawStatusBar() 
{
	int			decoymode;
	centity_t	*cent;
	playerState_t	*ps;

	if ( cg_drawStatus.integer == 0 ) {
		return;
	}

	// draw the team background
	// CG_DrawTeamBackground( 0, 420, 640, 60, 0.33, cg.snap->ps.persistant[PERS_TEAM] );


	// don't display flag in decoymode
	if (classtype == BOTS_BODYGUARD)
	{
		decoymode = atoi(Info_ValueForKey(  info, "d" ));
		if (decoymode > cg.time)
			return;
	}

	cent = &cg_entities[cg.snap->ps.clientNum];
	ps = &cg.snap->ps;

	if (cg.predictedPlayerState.powerups[PW_REDFLAG])
		CG_DrawStatusBarFlag( 185 + CHAR_WIDTH*3 + TEXT_ICON_SPACE + ICON_SIZE, TEAM_RED);
	else if (cg.predictedPlayerState.powerups[PW_BLUEFLAG])
		CG_DrawStatusBarFlag( 185 + CHAR_WIDTH*3 + TEXT_ICON_SPACE + ICON_SIZE, TEAM_BLUE);
}


















